package com.aiyige.page.my.sell.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.aiyige.R;
import com.aiyige.page.my.sell.model.WaitReceiveMoneyModel;
import com.aiyige.utils.StringUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.LinkedList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class WaitReceiveMoneyListAdapter extends BaseQuickAdapter<WaitReceiveMoneyModel, BaseViewHolder> {

    @Override
    protected void convert(BaseViewHolder helper, WaitReceiveMoneyModel item) {
        ((MyHolder) helper).bindData(item);
    }

    public WaitReceiveMoneyListAdapter() {
        super(new LinkedList<WaitReceiveMoneyModel>());
    }

    @Override
    protected BaseViewHolder onCreateDefViewHolder(ViewGroup parent, int viewType) {
        BaseViewHolder baseViewHolder = new MyHolder(getItemView(R.layout.item_wait_receive_money, parent));
        return baseViewHolder;
    }

    public class MyHolder extends BaseViewHolder {
        @BindView(R.id.tv_price)
        TextView tvPrice;
        @BindView(R.id.tv_name)
        TextView tvName;

        WaitReceiveMoneyModel entity;

        public MyHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(final WaitReceiveMoneyModel baseEntity) {
            entity = baseEntity;
            tvPrice.setText(StringUtils.priceFormat(baseEntity.getWaitPay()));
            tvName.setText(baseEntity.getName());
        }
    }

}
